/**
 * 
 */
package cn.softTank.BpelModelImpl;

import org.dom4j.Element;

import cn.softTank.BpelModel.MessageExchange;
import cn.softTank.BpelModel.Reply;
import cn.softTank.BpelModel.ToParts;
import cn.softTank.BpelModel.Variable;

/**
 * @author Yuzone (smartzxy@gmail.com)
 * 
 */
public class ReplyImpl extends PartnerActivityImpl implements Reply {

	private Variable variable;
	private String faultName;
	private MessageExchange messageExchange;
	private ToParts toParts;

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.Reply#getFaultName()
	 */
	@Override
	public String getFaultName() {
		return faultName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.Reply#getMessageExchange()
	 */
	@Override
	public MessageExchange getMessageExchange() {
		return messageExchange;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.Reply#getToParts()
	 */
	@Override
	public ToParts getToParts() {
		return toParts;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.Reply#getVariable()
	 */
	@Override
	public Variable getVariable() {
		return variable;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.Reply#setFaultName(java.lang.String)
	 */
	@Override
	public void setFaultName(String value) {
		faultName = value;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * cn.softTank.BpelModel.Reply#setMessageExchange(cn.softTank.BpelModel.
	 * MessageExchange)
	 */
	@Override
	public void setMessageExchange(MessageExchange value) {
		messageExchange = value;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * cn.softTank.BpelModel.Reply#setToParts(cn.softTank.BpelModel.ToParts)
	 */
	@Override
	public void setToParts(ToParts value) {
		toParts = value;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * cn.softTank.BpelModel.Reply#setVariable(cn.softTank.BpelModel.Variable)
	 */
	@Override
	public void setVariable(Variable value) {
		variable = value;
	}

	@Override
	public Element toElement() {
		node = super.toElement();
		node.setName("reply");
		if (variable != null)
			node.addAttribute("variable", variable.getName());
		if (faultName != null)
			node.addAttribute("faultName", faultName);
		if (messageExchange != null)
			node.addAttribute("messageExchange", messageExchange.getName());
		if (toParts != null)
			node.add(toParts.toElement());
		return node;
	}

}
